package lab01;
import java.util.Scanner;

/**
 * Created by 阿阿阿阿豪丶 on 2017/10/8.
 */
public class Test12 {
    public static void main(String[] args) {
        System.out.println("请输入1-9999任意一个数字");
        Scanner sc = new Scanner(System.in);
        int num0 = sc.nextInt();
        int n;
        int num1;
        int unit = num0 % 10;
        int ten = (num0 %100)/10;
        int hundred = (num0 %1000)/100;
        int thousand = num0 / 1000;
        if(thousand != 0){
            n = 4;
            num1 = unit * 1000 + ten * 100 + hundred * 10 + thousand;
        }
        else if (hundred != 0){
            n = 3;
            num1 = unit * 100 + ten *10 + hundred;
        }
        else if (ten != 0){
            n = 2;
            num1 = unit * 10 + ten;
        }
        else {
            n = 1;
            num1 = unit;
            System.out.println(num1 + "不是回文数");
        }
        if (n >= 2){
            System.out.println(num0 + "是" + n +"位数");
        }
        if (num0 == num1){
            System.out.printf(num0 + "是回文数");
        }
        else {
            System.out.println(num0 + "不是回文数");
        }
    }
}
